<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0"/>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>会员中心 - 银联订单付账跳转</title>
<link href="__STATIC__/weixin/css/content.css" rel="stylesheet" type="text/css" />
<link href="__STATIC__/weixin/css/shop.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="__STATIC__/weixin/js/jquery.js" charset="utf-8"></script>
<script type="text/javascript" src="__STATIC__/weixin/js/ecmall.js" charset="utf-8"></script>
<script type="text/javascript" src="__STATIC__/weixin/js/touchslider.dev.js" charset="utf-8"></script>
<script type="text/javascript">

var SITE_URL = "http://store.weiapps.cn";
var REAL_SITE_URL = "http://store.weiapps.cn";
var PRICE_FORMAT = '¥%s';

$(function(){
    var span = $("#child_nav");
    span.hover(function(){
        $("#float_layer:not(:animated)").show();
    }, function(){
        $("#float_layer").hide();
    });
});

</script>
</head>

<body>
<include file="public:head" />
<div id="mcover" onclick="document.getElementById('mcover').style.display='';" style="display:none;">
    <img src="/tpl/User/default/common/images/openbrowser2.png" />
</div>
<!--<div id="content" onclick="document.getElementById('mcover').style.display='block';">-->
<div id="content" onclick="document.getElementById('mcover').style.display='';">
    <form action="{:U('order/end',array('tokenTall'=>$tokenTall))}" method="POST" id="goto_pay">
        <input type="hidden" name="orderid" value="{$orderid}" />
        <input type="hidden" name="dingdanhao" value="{$dingdanhao}" />
        <div class="step_main">
            <div class="buy" style="border:2px solid #ddd; background:#fff; border-radius:10px; padding:10px; overflow:hidden; margin-bottom:10px;">
                <h3>欢迎使用银联支付</h3>
                <p style="color:grey; font-size:15px; background-color: #DCDCDC; padding-left:10px;">支付金额：<span style="color:red;">¥{$ordersumPrice}</span></p>
                
                <div style="border:2px solid #ddd; background:#fff; border-radius:10px; padding:10px; overflow:hidden; margin-bottom:10px; margin-top:10px;">
				<if condition="$connectInfo eq '1'">
				<p style="color:green; font-size:15px; background-color: #fff; padding-left:10px;">请您点击银联图标进行支付</p>
                <a href="uppay://uppayservice/?style=token&paydata={$strOrderInfo}"><img src="__STATIC__/weixin/images/unionpay1.png" alt="银联手机支付"/></a>
				<elseif condition="$connectInfo eq 2"/>
				<p style="color:blue; font-size:15px; background-color: #fff; padding-left:10px;">您的订单已经支付</p>
				<else />
				<p style="color:red; font-size:15px; background-color: #fff; padding-left:10px;">订单信息提交银联失败</p>
				</if>
                </div>
                
				<div class="order_information" style="border:2px solid #ddd; background:#fff; border-radius:10px; padding:10px; overflow:hidden; margin-bottom:10px; margin-top:10px;">
                
                <p style="font-size:10px; color:purple;">如果您未安装过银联控件，请您下载安装</p>
                <h3>银联支付控件下载</h3>
                <dl class="defray" style="text-align:center;">
					<dd style="margin-top:10px">
						<a href="http://mobile.unionpay.com/getclient?platform=android&type=securepayplugin">
						<img src="__STATIC__/weixin/images/android.png" alt="Android银联支付控件在此下载"/></a>
					</dd>
					<dd>
						<a href="http://mobile.unionpay.com/getclient?platform=ios&type=securepayplugin">
						<img src="__STATIC__/weixin/images/apple.png" alt="IOS银联支付控件在此下载"/></a>
					</dd>
				</dl>
				</div>
            </div>            
        </div>
    </form>
</div>
<include file="public:footer" />
       
<script>
    var curWwwPath = window.document.location.href; 
    //获取主机地址之后的目录，如： cis/website/meun.htm 
    var pathName = window.document.location.pathname; 
    var pos = curWwwPath.indexOf(pathName); //获取主机地址，如： http://localhost:8080 
    var localhostPaht = curWwwPath.substring(0, pos); //获取带"/"的项目名，如：/cis 
    var projectName = pathName.substring(0, pathName.substr(1).indexOf('/') + 1); 
    var rootPath = localhostPaht + projectName; 
//"http://bestchoice88.com/tpl/Wap/default/share_nav.html"
window.shareData = {"appid":"wx4654d93678602ecb","imgUrl":"http://www.bestchoice88.com/tpl/Wap/default/common/images/friend.jpg","timeLineLink":"{lanrain:$shareData.url}","tTitle":"{lanrain:$shareData.title}","tContent":"{lanrain:$shareData.content}","wLink":null};
var ticket = 'Ar4d7EIBAADFNaxS',
    ticketSource = '',
    wticket = '0d0cc8020fd02b816f0b08aa2bc46216',
    qrcode = 'q13841544212332';

    var pageName = pageName ? pageName : '';
   
// 分享
function shareFriend(appid, imgUrl, sendFriendLink, fContent, fTitle) {
    
    WeixinJSBridge.invoke('sendAppMessage',{
                            "appid":appid,
                            "img_url":imgUrl,
                            "img_width":"640",
                            "img_height":"640",
                            "link":sendFriendLink,
                            "desc":fContent,
                            "title":fTitle
                            }, function(res) {
//                            _report('send_msg', res.err_msg);
                             window.location.href="http://bestchoice88.com/index.php?g=Wap&m=Share&a=index&shared=M&shareOp="+res.err_msg;
                            });
  
}
function shareTimeline(imgUrl, timeLineLink, tContent, tTitle) {
    WeixinJSBridge.invoke('shareTimeline',{
                            "img_url":imgUrl,
                            "img_width":"640",
                            "img_height":"640",
                            "link":timeLineLink,
                            "desc": tContent,
                            "title": tTitle
                            }, function(res) {
//                            _report('timeline', res.err_msg);
                            window.location.href="http://bestchoice88.com/index.php?g=Wap&m=Share&a=index&shared=Y&shareOp="+res.err_msg;
                            });
}
function shareWeibo(wContent, wLink) {
    WeixinJSBridge.invoke('shareWeibo',{
                            "content":wContent,
                            "url":wLink,
                            }, function(res) {
//                            _report('weibo', res.err_msg);
                            window.location.href="http://bestchoice88.com/index.php?g=Wap&m=Share&a=index&shared=W&shareOp="+res.err_msg;
                            });
}
// 当微信内置浏览器完成内部初始化后会触发WeixinJSBridgeReady事件。
document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() {

        // 发送给好友
        WeixinJSBridge.on('menu:share:appmessage', function(argv){
            if (pageName == 'menuFilled') {

                var params = {
                    'qrcode' : qrcode,
                    'ticket' : ticket,
                    'ticketSource' : ticketSource
                };

                MLoading.show('加载中');
                setTimeout(function(){MLoading.hide();},3000);
                _doAjax('/weixin/dish/share', 'POST', params, function(ret){
                    MLoading.hide();
                    if (ret['code'] != 0) {
                        alert(ret['message']);
                        return;
                    }
                    var result = ret['result']['data'];

                    shareFriend(result.appid, result.img_url, result.link, result.desc, result.title);
                });

            } else {
                shareFriend(window.shareData.appid, window.shareData.imgUrl, window.shareData.sendFriendLink, window.shareData.fContent, window.shareData.fTitle);
            }
        });

        // 分享到朋友圈
        WeixinJSBridge.on('menu:share:timeline', function(argv){
            if (pageName == 'menuFilled') {

                var params = {
                    'qrcode' : qrcode,
                    'ticket' : ticket,
                    'ticketSource' : ticketSource
                };

                MLoading.show('加载中');
                setTimeout(function(){MLoading.hide();},3000);
                _doAjax('/weixin/dish/share', 'POST', params, function(ret){
                    MLoading.hide();
                    if (ret['code'] != 0) {
                        alert(ret['message']);
                        return;
                    }
                    var result = ret['result']['data'];

                    shareTimeline(result.img_url, result.link, result.desc, result.title);
                    
                });
                
            } else {

                shareTimeline(window.shareData.imgUrl, window.shareData.timeLineLink, window.shareData.tContent, window.shareData.tTitle);                
            }
        });

        // 分享到微博
        WeixinJSBridge.on('menu:share:weibo', function(argv){
            if (pageName == 'menuFilled') {

                var params = {
                    'qrcode' : qrcode,
                    'ticket' : ticket,
                    'ticketSource' : ticketSource
                };

                MLoading.show('加载中');
                setTimeout(function(){MLoading.hide();},3000);
                _doAjax('/weixin/dish/share', 'POST', params, function(ret){
                    MLoading.hide();
                    if (ret['code'] != 0) {
                        alert(ret['message']);
                        return;
                    }
                    var result = ret['result']['data'];

                    shareWeibo(result.title, result.link);
                });

            } else {

                shareWeibo(window.shareData.wContent, window.shareData.wLink);
            }
        });
     }, false)

</script>
<script>
    var needLocate = 'no';
    needLocate = needLocate != 'no';


function locate(){
    if (navigator && navigator.geolocation) {
        navigator.geolocation.getCurrentPosition(geo_success, geo_error, {timeout:3000});
    } else {
        MDialog.notice('定位失败，请检查网络设置', null, 3000);
    }
}
function geo_success(position) {
    window.location.href="/weixin/dish/listShop?needLocate=no&latitude="+position.coords.latitude+"&longitude="+position.coords.longitude+"&qrcode="+qrcode+"&ticket="+ticket+'#wechat_webview_type=1';
}
function geo_error() {
    // MDialog.notice('定位失败，请检查网络设置', null, 3000);

    if (needLocate) {
        window.location.href="/weixin/dish/listShop?qrcode="+qrcode+"&ticket="+ticket+"&needLocate=no"+'#wechat_webview_type=1';
    }
}

_onPageLoaded(function(){

    if (needLocate) {
        locate();
        return;
    }

    //修复滑动时搜索条(有较多输入内容)闪烁残缺的现象
    if (_env.ios){
        var ts = _q('.topSearch');
        var ts2 = ts.cloneNode();
        ts2.id = 'fixIOSTopSearch';
        ts2.style.zIndex = 98;
        ts2.innerHTML = '';
        ts.parentNode.appendChild(ts2);
    }

    (function() {

        // ios下系统默认弹窗
        if (_isIOS) {
            return null;
        }

        var orderBtns = _qAll('.order');
        
        for(var i=0;i<orderBtns.length;i++) {
            orderBtns[i].onclick = function(e) {
                var self = this;
                var phone = self.getAttribute('href').match(/\d*-?\d+/);
                if (!phone[0]) {phone[0]='';}
                MDialog.confirm(
                    '', '<span style="text-align:center !important;display:inline-block;width:205px;">是否拨打预订电话<br/>'+phone[0]+'？</span>', null,
                    '确定', function(){
                        isCancle = false;

                        location.href = self.getAttribute('href');
                    }, null,
                    '取消', null, null,
                    null, true, true
                );

                return false;
            }
        }
    })();
});


</script>
</body>
</html>